< previous page page_28 next page >

Page 28
Let's try another one to be safe. The air conditioner is an object whose behavior is to supply cool air when the weather is hot (forget cold weather for this examplesorry, Northerners). Of course, you don't simply tell the AC to turn itself on and adjust itself to your favorite temperature (but that technology is not far off). The high-level protocol calls for you to push some buttons and slide some levers. These buttons and levers are the interface to the AC. When you push the On button, this event (pushing the button) causes the button's internal methods to send an electric message to the AC to power up. Another way of explaining this power up process is that the AC initializes itself to either default (factory) settings or your previous settings. Other real-world objects have interfaces as well, such as your thermostat in your home, your microwave, and your television, among others. In turn, these objects interface with the object that supplies electricity. Because the real world operates with classes, objects, and their interfaces, why not use the same paradigm in software development?
Understanding Subsystems/Packages
Now that you've become familiar with the nature of classes and objects, it's time to introduce another concept. In the real world, or at least in theory, every object is made up of smaller objects. For instance, humans are made up of organs. In turn, these organs are made up of atoms. Likewise, a well-developed, object-oriented application comprises subsystems (or categories or packages), which are composed of classes (or sometimes other subsystems).
Definition
A subsystem is a portion of the application/system that carries out a particular behavior of the entire application/system. This portion can consist of classes as well as other subsystems. For instance, you can design a portion of an application to manage all database retrieval and storage (database subsystem), another to handle the display of data in and retrieval of data from GUI objects (GUI subsystem), and yet another to handle printing and reporting (printing and reporting subsystem). Going back to the Sebring example, the portion of the car (synonymous with application for your purposes) that handles the movement energy is the engine. The portion that handles stopping is the braking mechanism. The portion that handles air flow and temperature control is the AC. The engine subsystem (or portion), in turn, consists of different classes of nuts and bolts, as well as other subsystems, such as timing, cooling, starting (ignition), and so on. On another front, your house would be like an application, and it, too, has portions. Your house contains the AC subsystem (with some abstract similarities to the car's AC), the plumbing

 
< previous page page_28 next page >

If you like this book, buy it!